package com.system.dao;

import com.system.dao.impl.CourseDaoImpl;
import com.system.dao.impl.RemarkDaoImpl;
import com.system.dao.impl.ScoreDaoImpl;
import com.system.dao.impl.StudentDaoImpl;
import com.system.dao.impl.TeacherDaoImpl;
import com.system.dao.impl.UserDaoImpl;

public class DaoFactory {
	private static DaoFactory instance = null;

	private DaoFactory() {
	}

	public synchronized static DaoFactory getInstance() {
		if (instance == null) {
			instance = new DaoFactory();
		}
		return instance;
	}
	
	public UserDao createUserDao(){
		UserDao userDao=null;
		try {
			userDao=new UserDaoImpl();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return userDao;
	}
	
	public StudentDao createStuDao() {
		StudentDao stuDao = null;
		try {
			stuDao = new StudentDaoImpl();
		} catch(Exception e) {
			e.printStackTrace();
		}
		return stuDao;
	}
	
	public CourseDao createCourseDao() {
		CourseDao courseDao = null;
		try {
			courseDao = new CourseDaoImpl();
		} catch(Exception e) {
			e.printStackTrace();
		}
		return courseDao;
	}
	
	public TeacherDao createTeacherDao() {
		TeacherDao teacherDao = null;
		try {
			teacherDao = new TeacherDaoImpl();
		} catch(Exception e) {
			e.printStackTrace();
		}
		return teacherDao;
	}
	
	public ScoreDao createScoreDao() {
		ScoreDao scoreDao = null;
		try {
			scoreDao = new ScoreDaoImpl();
		} catch(Exception e) {
			e.printStackTrace();
		}
		return scoreDao;
	}
	
	public RemarkDao createRemarkDao(){
		RemarkDao remarkDao=null;
		try{
			remarkDao=new RemarkDaoImpl();
		}catch(Exception e){
			e.printStackTrace();
		}
		return remarkDao;
	}
}
